/**
 * App > home + list +detail
 * react - router-dom中有两种模式：BrowserRouter（history模式） hashRouter(Hash模式)
 */
import React from 'react';
import App from '../Apply'
import Home from '../pages/Home'
import Error  from '../pages/Error'
import UserList  from '../pages/UserList'
import Login from '../pages/Login'
import AddUser from "../pages/user/AddUser";
import { BrowserRouter,Routes,Route } from 'react-router-dom'
import UpdateUser from "../pages/user/UpdateUser";
// 区域列表
import AreaTable from '../pages/Area/Table'
// 用户列表
import UserTable from '../pages/Users/Table'
// 分类列表
import ProductTypeTable from '../pages/ProductType/Table'
import BrandTable from '../pages/Brand/Table'
import ProductinfoTable from '../pages/Productinfo/Table'
import Details from '../pages/Productinfo/Details'
import ShoppingCart from '../pages/ShoppingCart/shoppingCart'
import Handsontable from '../pages/handsontable/handsontable'
import AreaApp from '../redux/Area/components/App'

//定义一个路由
const BaseRouter = () => (
    <BrowserRouter>
        <Routes>
            <Route path='/' element={<App />}>
                {/*设置首页显示界面*/}
                <Route path='/' element={<Home />}></Route>
                {/*错误页面在显示卡中*/}
                <Route path='/error' element={<Error />}></Route>
                <Route path='/userList' element={<UserList />}></Route>
                <Route path='/login' element={<Login />}></Route>
                <Route path='/addUser' element={<AddUser />}></Route>
                <Route path='/home' element={<Home />}></Route>
                <Route path='/updateUser' element={<UpdateUser />}></Route>

                {/*React antd 显示效果*/}
                <Route path='/toArea' element={<AreaTable />}></Route>
                <Route path='/toUser' element={<UserTable />}></Route>
                <Route path='/toProductType' element={<ProductTypeTable />}></Route>
                <Route path='/toBrand' element={<BrandTable />}></Route>
                <Route path='/toProductinfo' element={<ProductinfoTable />}></Route>
                {/*商品详情*/}
                <Route exact path='/toProductinfo/Details/:id'  element={<Details/>}></Route>
                {/*购物车*/}
                <Route exact path='/toShoppingCart' element={<ShoppingCart/>}></Route>
                <Route path="/toHandsontable" element={<Handsontable/>}></Route>
                <Route path="/toAreaApp" element={<AreaApp/>}></Route>
            </Route>
            {/*独立显示错误界面*/}
            <Route path='*' element={<Error/>}></Route>
        </Routes>
    </BrowserRouter>
)
export default BaseRouter;
